//---------------Sonic CD Kamemusi Bullet Script--------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

// Aliases
#alias Object.Value0	:	Object.FrameTimer
#alias Object.Value1	:	Object.XVelocity
#alias Object.Value2	:	Object.YVelocity


sub ObjectMain
	Object.YVelocity += 0x2000
	Object.XPos += Object.XVelocity
	Object.YPos += Object.YVelocity

	if Object.OutOfBounds == true
		Object.Type = TypeName[Blank Object]
	else	// if it goes above the visible screen, delete them
		TempValue0   = Screen.YOffset
		TempValue0  -= 8
		TempValue0 <<= 16
		if Object.YPos < TempValue0
			Object.Type = TypeName[Blank Object]
		end if

	end if
end sub


sub ObjectPlayerInteraction
	PlayerObjectCollision(C_TOUCH, -4, -4, 4, 4)
	if CheckResult == true
		CallFunction(Player_Hit)
	end if
end sub


sub ObjectDraw
	DrawSprite(Object.Frame)

	Object.FrameTimer++
	if Object.FrameTimer > 2
		Object.FrameTimer = 0

		Object.Frame++
		Object.Frame &= 3
	end if
end sub


sub ObjectStartup
	LoadSpriteSheet("R4.5/Objects.gif")

	SpriteFrame(-4, -4, 8, 8, 34, 14)		// #0 - Small Bullet Frame 0
	SpriteFrame(-4, -4, 8, 8, 43, 14)		// #1 - Small Bullet Frame 1
	SpriteFrame(-6, -6, 12, 12, 34, 1)	// #2 - Big Bullet Frame 0
	SpriteFrame(-6, -6, 12, 12, 47, 1)	// #3 - Big Bullet Frame 1
end sub


// ========================
// Editor Subs
// ========================

sub RSDKDraw
	DrawSprite(0)
end sub


sub RSDKLoad
	LoadSpriteSheet("R1/Objects.gif")
	SpriteFrame(-4, -4, 8, 8, 166, 34)		// #0 - Small Bullet

	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end sub
